package com.ruanjian.api.controller;

import com.ruanjian.api.bean.ExperimentFund;
import com.ruanjian.api.utils.AjaxResult;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author shkstart
 * @create 2022-11-23 11:51
 */
@Api(tags = "基金接口")
@Slf4j
@RestController
@RequestMapping("/api/java/ExperimentFund")
public class ExperimentFundController extends BaseController{

    /**
     * 列出每轮基金变化/投入情况
     * @param userId 用户id
     * @return 基金每轮变化
     */
    @CrossOrigin
    @GetMapping(value = "/listFundsByUserId/{userId}")
    public AjaxResult listFundsByUserId(@PathVariable("userId") Long userId){
        return AjaxResult.success().add("funds",fundService.listFundsByUserId(userId));
    }

    /**
     * 列出基金信息
     * @param fund 用户id、阶段id、轮数id
     * @return 基金基本信息
     */
    @CrossOrigin
    @PostMapping("/listFundsSelective")
    public AjaxResult listFundsSelective(@RequestBody ExperimentFund fund){
        return AjaxResult.success().add("FundsSelective",fundService.listFundsSelective(fund));
    }

    @CrossOrigin
    @PostMapping("/listFundByFundId")
    public AjaxResult listFundByFundId(@RequestBody ExperimentFund fund){
        return AjaxResult.success().add("FundByFundId",fundService.listFundByFundId(fund));
    }

}
